{% extends "blog_base.html" %}

{% block title %}最新日志列表{{sitename}}{% endblock %}

{% block extrahead %}
<style>
#object-list li{border:1px solid #ff8800;margin:5px;}
</style>
{% endblock %}

{% block sidebar %}
<style>
    <!--
    body, p, div,td,input {font:menu;line-height: 150%}
    .div { font-family: 宋体; font-size: 12px; line-height: 150% }
    .thtxt{background-color:#FBBA59;FONT-SIZE: 9pt;text-align:center;}
    .tdtxt{FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #330066; FONT-FAMILY: Arial}
    -->
    </style>
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    //创建一个数组,用于存放每个月的天数
    function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) 
    {
    this[0] = m0;
    this[1] = m1;
    this[2] = m2;
    this[3] = m3;
    this[4] = m4;
    this[5] = m5;
    this[6] = m6;
    this[7] = m7;
    this[8] = m8;
    this[9] = m9;
    this[10] = m10;
    this[11] = m11;
    }
    //实现月历
    function calendar() {
    var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
    var today = new Date();
    var thisDay;
    var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    var blogDays="{% for object in object_list %}{{object.pub_date|date:"j"}},{% endfor %}";
    blogDays=blogDays.substr(0,blogDays.length-1);
    var blogDaysArr=blogDays.split(',');
    year = today.getYear() +1900;
    thisDay = today.getDate();
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;
    nDays = monthDays[today.getMonth()];
    firstDay = today;
    firstDay.setDate(1);
    testMe = firstDay.getDate();
    if (testMe == 2) firstDay.setDate(0);
    startDay = firstDay.getDay();
    document.write("<div id='rili' style='width:140px;left:300px;top:100px;'>") 
    document.write("<TABLE width='196' BORDER='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#0080FF'>")
    document.write("<TR><TD><table border='0' cellspacing='1' cellpadding='2' bgcolor='Silver'>");
    var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
    var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
    var now = new Date();
    document.writeln("<TR><th colspan='7' bgcolor='#C8E3FF' align='center'><span STYLE='font-size:9pt;Color:#330099'>" + "今天" + now.getYear() + "年" + monthNames[now.getMonth()] +   now.getDate() + "日 " + dayNames[now.getDay()] + "</span></TH></TR>");
    document.writeln("<TR><th colspan='7' bgcolor='#C8E3FF' align='center'><span STYLE='font-size:9pt;Color:#330099'> {%ifnotequal previous_month None%}<a href='/blog/archive/{{previous_month|date:"Y/m"}}/'>{{previous_month|date:"m"}}月</a>{%endifnotequal%} {{month|date:"Y年m月"}} {%ifnotequal next_month None%}<a href='/blog/archive/{{next_month|date:"Y/m"}}/'>{{next_month|date:"m"}}月</a>{%endifnotequal%}</span></TH></TR>");
    document.writeln("<tr><th class='thtxt'>日</span></th>");
    document.writeln("<th class='thtxt'>一</th>");
    document.writeln("<th class='thtxt'>二</th>");
    document.writeln("<th class='thtxt'>三</th>");
    document.writeln("<th class='thtxt'>四</th>");
    document.writeln("<th class='thtxt'>五</th>");
    document.writeln("<th class='thtxt'>六</th>");
    document.writeln("</tr><tr>");
    column = 0;
    for (i=0; i<startDay; i++) {
    document.writeln("\n<TD><span STYLE='font-size:9pt'> </span></TD>");
    column++;
    }for (i=1; i<=nDays; i++) {
    if (i == thisDay) {
    document.writeln("</TD><TD ALIGN='CENTER' BGCOLOR='#FF8040'><span STYLE='font-size:9pt;Color:#ffffff'><B>")
    }
    else {
    document.writeln("</TD><TD BGCOLOR='#FFFFFF' ALIGN='CENTER'><span class='tdtxt'>");
    }
    //document.writeln(blogDaysArr);
    var haveposted=false;
    for(bi=0;bi<blogDaysArr.length;bi++){
        if (i==blogDaysArr[bi]){
            haveposted=true;
            break;
            }else{haveposted=false}
        //
    }
    if(haveposted==true){ document.writeln("<a href='/blog/archive/{{month|date:"Y/m"}}/"+i+"'>"+i+"</a>");  }else{ document.writeln(i);}
    if (i == thisDay) document.writeln("</span></TD>")
    column++;
    if (column == 7) {
    document.writeln("<TR>");
    column = 0;
    }
    }
    document.writeln("<TR><TD COLSPAN='7' ALIGN='CENTER' VALIGN='TOP' BGCOLOR='#F2B068'>")
    document.writeln("<FORM NAME='clock' onSubmit='0'><FONT STYLE='font-size:9pt;Color:#ffffff'>")
    document.writeln("现在时间:<INPUT TYPE='Text' NAME='face' ALIGN='TOP'></FONT></FORM></TD></TR></TABLE>")
    document.writeln("</TD></TR></TABLE></div>");
    }
    </SCRIPT>
    <SCRIPT LANGUAGE="JavaScript">
    var timerID = null;
    var timerRunning = false;function stopclock (){
    if(timerRunning)
    clearTimeout(timerID);
    timerRunning = false;}//显示当前时间
    function showtime () {
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds()
    var timeValue = " " + ((hours >12) ? hours -12 :hours)
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
    timeValue += (hours >= 12) ? " 下午 " : " 上午 ";
    document.clock.face.value = timeValue;
    timerID = setTimeout("showtime()",1000);//设置超时,使时间动态显示
    timerRunning = true;}
    function startclock () {stopclock(); showtime();}
    </SCRIPT>
    <body  onLoad="startclock(); timerONE=window.setTimeout"text="#000000">
    <script language="JavaScript" type="text/javascript">
    <!--
    calendar();
    //--></script>
{% endblock %}

{% block content %}
<div class="clearBOX">&nbsp;</div>
<div class='modth'>最新日志列表</div>

<div id="object-list"  class='list'>
{{month|date:"Y b"}}
<ul>
{% for object in object_list %}
<li> <a href="{{ object.get_absolute_url }}">{{ object.title|escape }}</a></li>
<span>{{ object.pub_date|timesince }}前发表</span>
{% endfor %}
</ul>

{% if month %}
<li><a href="/blog/archive/{{ next_month|date:"Y/m" }}">{{ next_month|date:"Y m" }}月</a>
<a href="/blog/archive/{{ previous_month|date:"Y/m" }}">{{ previous_month|date:"Y m" }}月</a></li>
{% endif %} 
</div>


{% endblock %}
